#include "bilbao/lang/LogManager.h"

namespace bilbao
{
	namespace lang
	{
		//--------------------------------------------------------------------------------
		LogManager* LogManager::_instance = NULL;
		Logger* LogManager::_result = NULL;
		//--------------------------------------------------------------------------------
		LogManager::LogManager(void)
		{
		}
		//--------------------------------------------------------------------------------
		LogManager::~LogManager(void)
		{
			delete( _instance );
			_instance = 0;

			delete( _result );
			_result = 0;
		}
		//--------------------------------------------------------------------------------
		LogManager* LogManager::getLogManager(void)
		{
			if ( !_instance )
			{
				_instance = new LogManager();
			}

			return _instance;
		}
		//--------------------------------------------------------------------------------
		Logger* LogManager::demandLogger( const char* log )
		{
			_result = loggers[log];

			if ( !_result )
			{
				_result = new Logger( log );
				loggers[log] = _result;
			}

			return _result;
		}
		//--------------------------------------------------------------------------------
	}
}
